<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head th:replace="common/common.html::common_css">
</head>
<script>
    function getHref(obj) {
        var a = document.getElementById("btn");
        a.href = obj.href;
    }
</script>
<body>
<div th:replace="common/admin_common.html::common_sidebar"></div>
<div class="page">
    <div th:replace="common/admin_common.html::common_navbar"></div>
    <!-- Breadcrumb-->
    <div class="breadcrumb-holder">
        <div class="container-fluid">
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a th:href="@{/admin/admin_index.html}">主页</a></li>
                <li class="breadcrumb-item"><a th:href="@{/admin/testlib_manage.html}">题库管理</a></li>
                <li class="breadcrumb-item active">题库详情</li>
            </ul>
        </div>
    </div>
    <section>
        <div class="container-fluid">
            <!-- Page Header-->
            <header>
                <h1 class="h3 display">题库信息</h1>
            </header>
            <div class="row">
                <div class="col-lg-6" style="flex:100%;max-width: 100%">
                    <div class="card">
                        <div class="card-header">
                            <h4 th:text="${apartmentname+'题库'}"></h4>
                        </div>
                        <div style="width: 100%;height: 100%;text-align: center">
                            <form class="text-left form-validate"
                                  th:action="@{/admin/question_qurey.html/{apartmentid}(apartmentid=${apartmentid})}"
                                  method="post">
                                <div style="text-align: center !important;">
                                    <div class="form-group-material" style="float: left;margin-left: 35%;top:25px">
                                        <input id="register-username" type="text"
                                               style="background-color: #fff !important;" name="qureymessage"
                                               class="input-material">
                                        <label for="register-username" class="label-material">输入关键词查询</label>
                                    </div>
                                    <div class="form-group text-center"
                                         style="float: left;margin-left: 20px;margin-top: 25px">
                                        <input id="register" type="submit" value="查询" class="btn btn-primary"
                                               style="width: 180px">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table">
                                <thead style="text-align: center">
                                <tr>
                                    <th>题目编号</th>
                                    <th>部门名称</th>
                                    <th>题目类型</th>
                                    <th>题目内容</th>
                                    <th>题目分值</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody style="text-align: center">
                                <tr th:each="question:${pageInfo.list}">
                                    <td th:text="${question.questionid}"></td>
                                    <td>
                                        <p th:text="${question.apartmentname}"></p>
                                    </td>
                                    <td>
                                        <p th:if="${question.type==1}">单 选</p>
                                        <p th:if="${question.type==2}">多 选</p>
                                        <p th:if="${question.type==3}">判 断</p>
                                    </td>
                                    <td th:text="${question.content}"></td>
                                    <td th:text="${question.point}"></td>
                                    <td>
                                        <a id="update"
                                           th:href="@{/admin/question_update.html/{id}(id=${question.questionid})}"
                                           class="btn btn-warning m-b-10 m-1-5" style="border-radius: 4px"
                                           type="button">详情</a>
                                </tr>
                                </tbody>
                            </table>
                        </div>

                    </div>
                    <div class="form-group">
                        <div style="float: right" th:replace="common/pageinfosplit.html :: pages_split"></div>
                        <div class="col-sm-2 control-label" style="top:-60px" sec:authorize="hasRole('Ctest')">
                            <button type="button" data-toggle="modal"
                                    data-target="#myModal" class="btn btn-info">添加题目
                            </button>
                        </div>
                        <div sec:authorize="hasRole('Ctest')" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                             aria-hidden="true" class="modal fade text-left">
                            <div role="document" class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 id="exampleModalLabel" class="modal-title">选择添加题目方式</h5>
                                        <button type="button" data-dismiss="modal" aria-label="Close"
                                                class="close"><span aria-hidden="true">×</span></button>
                                    </div>
                                    <div class="modal-footer"
                                         style="display: block;padding: 1rem;text-align: center;">
                                        <a style="width: 60%"
                                           th:href="@{/admin/question_add.html/{type}/{apartmentid}(type=1,apartmentid=${apartmentid})}"
                                           type="button" class="btn btn-primary">单 选 题</a>
                                    </div>
                                    <div class="modal-footer"
                                         style="display: block;padding: 1rem;text-align: center;">
                                        <a style="width: 60%"
                                           th:href="@{/admin/question_add.html/{type}/{apartmentid}(type=2,apartmentid=${apartmentid})}"
                                           type="button" class="btn btn-primary">多 选 题</a>
                                    </div>
                                    <div class="modal-footer"
                                         style="display: block;padding: 1rem;text-align: center;">
                                        <a style="width: 60%"
                                           th:href="@{/admin/question_add.html/{type}/{apartmentid}(type=3,apartmentid=${apartmentid})}"
                                           type="button" class="btn btn-primary">判 断 题</a>
                                    </div>
                                    <div class="modal-footer"
                                               style="display: block;padding: 1rem;text-align: center;">
                                    <a style="width: 60%"
                                       th:href="@{/admin/question_mutliup.html/{apartmentid}(apartmentid=${apartmentid})}"
                                       type="button" class="btn btn-primary">批 量 添 加</a>
                                </div>
                                    <div class="modal-footer"
                                         style="display: block;padding: 1rem;text-align: center;">
                                        <button style="width: 50%" type="button" data-dismiss="modal"
                                                class="btn btn-secondary">
                                            取消
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div th:replace="common/common.html::common_footer"></div>
</div>
<div th:replace="common/common.html::common_js">
</div>
</body>
</html>